home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / amislate / slaterexx / rainbowpen.rexx < prev    next >
OS/2 REXX Batch file  |  1995-08-05  |  1KB  |  53 lines

  1. /* RainbowPen.rexx
  2.  
  3.    An ARexx script for use with AmiSlate.
  4.    
  5.    Cycles the user's palette selection to make a neat "rainbow" effect
  6.    when the user draws with the pen or dot tools.
  7. */
  8.  
  9. /* Get our host's name--always given as first argument when run from Amislate */
  10. parse arg CommandPort ActiveString
  11.  
  12.  
  13. /* Necessary for "delay" to work */ 
  14. check = addlib('rexxsupport.library', 0, -30, 0)
  15.  
  16. if (length(CommandPort) == 0) then do
  17.     say ""
  18.     say "Usage:  rx rainbowpen.rexx <REXXPORTNAME>"
  19.     say "        (REXXPORTNAME is usually AMISLATE)"
  20.     say ""
  21.     say "Or run from the Rexx menu within AmiSlate."
  22.     say ""
  23.     exit 0
  24.     end
  25.  
  26. options results
  27.  
  28. /* Send all commands to this host */
  29. address (CommandPort) 
  30.  
  31.  
  32. CurrentPen=1
  33.  
  34. /* Get current palette depth and calculate 2^(depth)-1 for max pen # */
  35. getwindowattrs stem wind.
  36. MaxPen = 1
  37. do while (wind.depth > 0) 
  38.     MaxPen = MaxPen * 2
  39.     wind.depth = wind.depth - 1
  40. end
  41.  
  42. /* Adjust since palette is 0..(n-1) */
  43. MaxPen = MaxPen - 1
  44.  
  45. do while (1==1)
  46.     setuserfpen CurrentPen
  47.     
  48.     CurrentPen = CurrentPen + 1
  49.  
  50.     if (CurrentPen > MaxPen) then CurrentPen = 1
  51.  
  52.     result = delay(4)
  53. end